#include <iostream>
#include <unordered_map>

using namespace std;

int main()
{
    unordered_map<string, int> mp;

    int T; cin >> T;

    while(T--)
    {
        int op;
        string name;
        cin >> op;
        if(op == 1) // 插入 + 修改
        {
            cin >> name;
            int x; cin >> x;
            mp[name] = x;
            cout << "OK" << endl;
        }
        else if(op == 2) // 查询
        {
            cin >> name;
            if(mp.count(name)) cout << mp[name] << endl;
            else cout << "Not found" << endl;
        }
        else if(op == 3) // 删除
        {
            cin >> name;
            if(mp.count(name)) 
            {
                mp.erase(name); // 删除
                cout << "Deleted successfully" << endl;
            }
            else cout << "Not found" << endl;
        }
        else 
        {
            cout << mp.size() << endl;
        }
    }

    return 0;
}